<!--上传插件-->
<!--<script src="/static/js/jquery-2.1.1.js"></script>-->
<!--<script src="/static/bootstrap/js/bootstrap.js"></script>-->
<!--<link href="/static/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>-->

<!--<link href="/static/layui/css/layui.css" rel="stylesheet"/>-->
<!--<script src="/static/layui/layui.js"></script>-->
<!--&lt;!&ndash;引用layui弹框插件&ndash;&gt;-->

<!--<script src="/static/js/yii.js"></script>-->

<!--<link href="/static/css/fileinput.css" rel="stylesheet"/>-->
<!--<script src="/static/js/fileinput.js"></script>-->
<!--<script src="/static/js/fileinput_locale_zh.js" type="text/javascript"></script>-->

<!--<link href="/static/css/default/public.css" rel="stylesheet" type="text/css"/>-->

<div class="modal-header">

    <div class="assistant_header">
        <button type="button" class="close" data-dismiss="modal" close="true">
            <span aria-hidden="true">×</span>
        </button>
        <h4 class="modal-title">
            <span class="fa fa-legal"></span>&nbsp;选择用户
        </h4>
    </div>
</div>
<style>


</style>
<div class="modal-body">



    <div class="form-horizontal">
        <div class="form-group" style="margin: 15px 0;">
            <div class="input-group">
                <input class="form-control" name="keyword" id="keyword" type="text" placeholder="输入粉丝昵称/姓名/手机号/顾客uid进行搜索">
                <div class="input-group-btn">
                    <a class="btn btn-primary js_search" href="javascript:;" id="search"><i class="fa fa-search"></i> 搜索</a>
                </div>
            </div>
        </div>
    </div>


        <table class="table table-hover table-bordered text-center">
            <thead>
            <tr>
                <th class="text-center">头像</th>
                <th class="text-center">昵称</th>
                <th class="text-center">姓名</th>
                <th class="text-center">手机号</th>
                <th class="text-center">性别</th>
                <th class="text-center">身份证</th>
                <th class="text-center">操作</th>
            </tr>
            </thead>
            <tbody class="content">

            </tbody>
        </table>



        <div class="assistant_button" style="display: none">
            <button type="button" class="layui-btn layui-btn-primary js_quit" close="true">取消</button>
            <button type="button" class="layui-btn js_add" _event="user_add" data-id="0" data-name="" data-nickname="" >保存</button>
        </div>


</div>


<script>
    var indexinfo = (function () {
        var userList = "{:URL('common/Common/userList')}";
        return {
            userList: userList,
        };
    })();

    $(".content").on('click','.js_select',function(){
        var id = $(this).attr("data-id");
        var name = $(this).attr("data-name");
        var nickname = $(this).attr("data-nickname");
        $(".js_add").attr("data-id",id);
        $(".js_add").attr("data-name",name);
        $(".js_add").attr("data-nickname",nickname);
        $(".js_add").click();
        $(".js_quit").click();
    })


    $(".js_search").click(function () {
        var keyword = $("#keyword").val();
        $.ajax({
            type: "post",
            url: indexinfo.userList,
            data: {keyword:keyword},
            dataType: "json",
            success: function(data){
                var list = data.data;
                var html = "";
                $.each(list,function(index,element){
                    html +="<tr>";
                    html +="<td>"+element.id+" <img src="+element.avatar+" width='50'></td>";
                    html +="<td>"+element.nickname+"</td>";
                    html +="<td>"+element.realName+"</td>";
                    html +="<td>"+element.mobile+"</td>";
                    html +="<td>"+element.sex+"</td>";
                    html +="<td>"+element.idCard+"</td>";
                    html +='<td><a href="javascript:;" class="btn btn-primary js_select" data-name="'+element.nickname+'" data-nickname="'+element.nickname+'" data-id="'+element.id+'">选择</a></td>';
                    html +="</tr>";
                });

                $(".content").html(html);

            }
        });
    });

    $("#search").click(function () {
        var keyword = $("#keyword").val();
        $.ajax({
            type: "post",
            url: indexinfo.userList,
            data: {keyword:keyword},
            dataType: "json",
            success: function(data){
                var list = data.data;
                var html = "";
                $.each(list,function(index,element){
                    html +="<tr>";
                    html +="<td>"+element.id+" <img src="+element.avatar+" width='50'></td>";
                    html +="<td>"+element.nickname+"</td>";
                    html +="<td>"+element.realName+"</td>";
                    html +="<td>"+element.mobile+"</td>";
                    html +="<td>"+element.sex+"</td>";
                    html +="<td>"+element.idCard+"</td>";
                    html +='<td><a href="javascript:;" class="btn btn-primary js_select" data-name="'+element.realName+'" data-id="'+element.id+'">选择</a></td>';
                    html +="</tr>";
                });

               $(".content").html(html);

            }
        });
    });



</script>